package cn.asiawu.springboot.mapper;

import cn.asiawu.springboot.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

//@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {
    //一大串用于查询七天内每天注册人数
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 0 DAY)<=DATE(createtime)")
    Integer getDataInOneDay();
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 1 DAY)<=DATE(createtime)")
    Integer getDataInTwoDay();
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 2 DAY)<=DATE(createtime)")
    Integer getDataInThreeDay();
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 3 DAY)<=DATE(createtime)")
    Integer getDataInFourDay();
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 4 DAY)<=DATE(createtime)")
    Integer getDataInFiveDay();
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 5 DAY)<=DATE(createtime)")
    Integer getDataInSixDay();
    @Select("SELECT COUNT(*) FROM user WHERE DATE_SUB(curdate(),INTERVAL 6 DAY)<=DATE(createtime)")
    Integer getDataInSevenDay();

//    @Select("select * from user")
//    List<User> findAll();
//
//    @Insert("insert into user(username,password,nick_name,email,phone,address) values (#{username}," +
//            "#{password},#{nickName},#{email},#{phone},#{address})")
//    int insert(User user);
//
//    Integer update(User user);
//
//    @Delete("delete from user where id=#{id}")
//    Integer deleteById(@Param("id") Integer id);
//
//    @Select("select * from user where username like concat('%',#{username},'%') limit #{pageNum},#{pageSize}")
//    List<User> selectPage(Integer pageNum, Integer pageSize, String username);
//
//    @Select("select count(*) from user where username like concat('%',#{username},'%')")
//    Integer getTotal(String username);
}
